#pragma once
#include <string>
#include <Windows.H>
#include "errors.h"

using namespace std;
class TempFile
{
public:
	TempFile(void);
	int Init( wstring strFileName , long nSizeOfBuffer );
	int GetPresenter(); // Return the minimal element without removing from queue
	int GetLowerElement(); // Return the minimal element, and remove it from queue
	~TempFile(void);

	bool bIsEmpty; // !YOU SHOULD CHECK THIS BOOL BEFORE USING THIS TEMPFILE
private:
	bool bIsClosed;
	long lBufferLength; // !size not in bytes in sizes of int
	int* pBuffer; // Pointer to mapped part of memory
	long nBufferPointer; // Pointer to place for reading from mapped part of memory
	__int64 lFileSize; // Size of not-readed part of file
	__int64 lFileOffset; //Pointer to place in file to read
	HANDLE hFile;
	HANDLE hFileMapping;
};

